# 测试All-in-One服务器启动
$jarPath = "c:\lastWar\Server_2015021\java_last-war\all-in-one\target\all-in-one-1.0.0.jar"
$logFile = "c:\lastWar\Server_2015021\java_last-war\all-in-one\startup.log"

# 启动Java进程，将输出重定向到日志文件
Write-Host "Starting All-in-One Server, logging to $logFile"
Start-Process -FilePath "java" -ArgumentList "-jar `"$jarPath`"" -RedirectStandardOutput $logFile -RedirectStandardError $logFile -PassThru

# 等待5秒让应用启动
Start-Sleep -Seconds 5

# 读取日志文件查看启动情况
Write-Host "=== Startup Log ===" 
Get-Content $logFile | Select-String "SceneServer|BalanceServer|started successfully|Ready|error|Error" | Select-Object -Last 30

Write-Host "=== Full Log (Last 50 lines) ===" 
Get-Content $logFile | Select-Object -Last 50
